using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SudokuHelper.Model.Values {
    public class ValueRange : IValue {
        #region Static

        public static IList<byte> CreateFullList() {
            return new List<byte> {1, 2, 3, 4, 5, 6, 7, 8, 9};
        }

        #endregion

        #region Properties

        public IList<byte> AvailableValues { get; private set; }

        #endregion

        #region Constructors

        public ValueRange(IList<byte> availableValues) {
            AvailableValues = availableValues;
        }

        public ValueRange() : this(CreateFullList()) {
        }

        #endregion

        #region Implementation of IValue

        public object Accept(IValueVisitor valueVisitor, object arg) {
            return valueVisitor.Visit(this, arg);
        }

        public void Dispatch(IValueRelation other, ValueRelationDispatcher dispatcher) {
            dispatcher.Dispatch(this, other);
        }

        public void Dispatch(UserValue userValue, ValueRelationDispatcher dispatcher) {
            dispatcher.Perform(userValue, this);
        }

        public void Dispatch(CalculatedValue calculatedValue, ValueRelationDispatcher dispatcher) {
            dispatcher.Perform(calculatedValue, this);
        }

        public void Dispatch(ValueRange range, ValueRelationDispatcher dispatcher) {
            dispatcher.Perform(range, this);
        }

        #endregion
    }
}